package service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import entity.Customer_loss;
import entity.LayRequest;
import mapper.Customer_lossMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class Customer_lossServiceImpl implements Customer_lossService{
    @Autowired
    private Customer_lossMapper customer_lossMapper;

    @Override
    public PageInfo<Customer_loss> selectByPage(LayRequest layRequest) {
        PageHelper.startPage(layRequest.getPage(),layRequest.getLimit());
        List<Customer_loss> customer_losses = customer_lossMapper.selectByPage(layRequest.getParams());
        PageInfo<Customer_loss> customer_lossPageInfo = new PageInfo<>(customer_losses);
        return customer_lossPageInfo;
    }

    @Override
    public Customer_loss selectById(Integer id) {
        return customer_lossMapper.selectById(id);
    }

    @Override
    public boolean insert(Customer_loss customer_loss) {
        return customer_lossMapper.insert(customer_loss)>0?true:false;
    }

    @Override
    public boolean delete(Integer id) {
        return customer_lossMapper.delete(id)>0?true:false;
    }

    @Override
    public boolean update(Customer_loss customer_loss) {
        return customer_lossMapper.update(customer_loss)>0?true:false;
    }
}

